#!/bin/bash
set -e
hostnamectl set-hostname cloudnode
apt update
apt install -y docker.io
tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://hipzsnyz.mirror.aliyuncs.com"]
}
EOF
systemctl daemon-reload
systemctl restart docker
docker --version
#docker版本Docker version 20.10.7, build 20.10.7-0ubuntu5~20.04.2

#2. 安装k8s的kubeam等
apt install -y apt-transport-https
curl https://mirrors.aliyun.com/kubernetes/apt/doc/apt-key.gpg | apt-key add -
cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
deb https://mirrors.aliyun.com/kubernetes/apt/ kubernetes-xenial main
EOF
apt update
apt install  kubectl=1.18.0-00 kubelet=1.18.0-00 kubeadm=1.18.0-00 -y
systemctl enable kubelet

iptables -t nat -A OUTPUT -d 47.103.81.142 -j DNAT --to-destination 172.24.23.137


### new
swapoff -a

140.82.112.3 github.com
199.232.69.194 github.global.ssl.fastly.net

github.com.cnpmjs.org


#修改/etc/ssh/sshd_config，不要搞错文件
```
GSSAPIAuthentication no #删除注释
```
systemctl restart ssh


wget https://golang.google.cn/dl/go1.17.4.linux-amd64.tar.gz
tar -C /usr/local -xzf go1.17.4.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin
go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.cn,https://goproxy.io,direct







$ _output/bin/yurtctl init --image-repository=registry.cn-hangzhou.aliyuncs.com/google_containers --kubernetes-version=v1.18.8  --pod-network-cidr=10.244.0.0/16 --ignore-preflight-errors=FileExisting-conntrack --apiserver-cert-extra-sans=47.103.81.142





kubeadm reset -f
rm -rf /etc/cni/net.d

kubeadm init --image-repository registry.aliyuncs.com/google_containers --pod-network-cidr=10.244.0.0/16 --apiserver-cert-extra-sans=公网ip

mkdir -p $HOME/.kube
echo "hi"

cp  /etc/kubernetes/admin.conf $HOME/.kube/config
chown $(id -u):$(id -g) $HOME/.kube/config

